# The purpose is to package the CBM service as a deploy unit.

FROM docker.wetranslate.huawei.com/wetranslate/api-base:latest
MAINTAINER "Huang Quanbin" <qbhuang@thoughtworks.com>

# Prepare work directories
ENV APP_DIR  /opt/huawei/apps/translate/
ENV RESOURCES_DIR $APP_DIR/resources/
ENV LIB_DIR $APP_DIR/lib/

RUN mkdir -p $APP_DIR

WORKDIR $APP_DIR
COPY build/libs/hw-translate.jar $APP_DIR
COPY config/resources $RESOURCES_DIR
COPY config/lib $LIB_DIR
COPY startup.sh $APP_DIR
RUN chmod u+x ./startup.sh
HEALTHCHECK CMD wget -qO-  http://localhost:8080/api/health || exit 1
EXPOSE 8080
CMD ["./startup.sh"]
